﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lamex.SIESystemManager.Calculate
{
    public class C_D24
    {
        public double GetD24(DataRow[] dr1, DataRow[] dr2)
        {
            int count = 0;//定义A的个数-输入框不为0
            double TBHours = 0;
            double TD24 = 0, Tw1 = 0, Tw2 = 0, Td1 = 0, Td2 = 0;
            double TFACTOR_W1 = 0;//系数阔度W1
            double TFACTOR_W2 = 0;//系数阔度W2
            double TFACTOR_D1 = 0;//系数深度D1
            double TFACTOR_D2 = 0;//系数深度D2
            double TFACTOR_Z1 = 0;//系数转角Z
            double TBOARD_GONG_GAP = 0;//板面锣缺口
            double TBOARD_GONG_SIRCULAR_HORN = 0;//板面锣圆角
            double TBOARD_T_EDGE_HORN = 0;//板面切封角
            double TEDGE_S_STRAKE = 0;//封直线边条
            double TGONG_PLANE_GROOVE_M = 0;//锣平面盲槽
            double TGONG_PLANE_GROOVE_T = 0;//锣平面通槽
            double TDRILL_VERTICAL_HOLE_M = 0;//钻垂直盲孔
            double TDRILL_VERTICAL_HOLE_T = 0;//钻垂直通孔
            double TDRILL_HY_HOLE = 0;//钻开合页孔
            double TDRILL_PJ_HOLE = 0;//钻开平铰孔
            double TGROOVE_COLOR_SIDE = 0;//槽侧边擦色
            double THOLE_COPPER_PLUG = 0;//打铜头胶塞
            double TTWIST_TOOTHED_NUT = 0;//拧带齿螺母
            double TPASTE_LAMEX_LOGO = 0;//贴美时LOGO
            double TPASTE_COMMON_LABLE = 0;//贴通用标签
            double TASSEMBLE_BRUSH_BAR = 0;//装压毛刷条
            double TD24_Plate_Thickness_Cut_Slope = 0;//板厚切斜边

            double TUNIT_WORKHOURSW1 = 0;//单位工时w1
            double TATTACH_WORKHOURSW1 = 0;//附加工时w1
            double TUNIT_WORKHOURSW2 = 0;//单位工时w2
            double TATTACH_WORKHOURSW2 = 0;//附加工时w2
            double TUNIT_WORKHOURSD1 = 0;//单位工时D1
            double TATTACH_WORKHOURSD1 = 0;//附加工时D1
            double TUNIT_WORKHOURSD2 = 0;//单位工时D2
            double TATTACH_WORKHOURSD2 = 0;//附加工时D2
            double TUNIT_WORKHOURSZ = 0;//单位工时Z
            double TATTACH_WORKHOURSZ = 0;//附加工时Z
            double WBOARD_GONG_GAP = 0;//单位工时-板面锣缺口
            double ABOARD_GONG_GAP = 0;//附件工时-板面锣缺口
            double WBOARD_GONG_SIRCULAR_HORN = 0;//单位工时-板面锣圆角
            double ABOARD_GONG_SIRCULAR_HORN = 0;//附件工时-板面锣圆角
            double WBOARD_T_EDGE_HORN = 0;//单位工时-板面切封角
            double ABOARD_T_EDGE_HORN = 0;//附件工时-板面切封角
            double WEDGE_S_STRAKE = 0;//单位工时-封直线边条
            double AEDGE_S_STRAKE = 0;//附件工时-封直线边条
            double WGONG_PLANE_GROOVE_M = 0;//单位工时-锣平面盲槽
            double AGONG_PLANE_GROOVE_M = 0;//附件工时-锣平面盲槽
            double WGONG_PLANE_GROOVE_T = 0;//单位工时-锣平面通槽
            double AGONG_PLANE_GROOVE_T = 0;//附件工时-锣平面通槽
            double WDRILL_VERTICAL_HOLE_M = 0;//单位工时-钻垂直盲孔
            double ADRILL_VERTICAL_HOLE_M = 0;//附件工时-钻垂直盲孔
            double WDRILL_VERTICAL_HOLE_T = 0;//单位工时-钻垂直通孔
            double ADRILL_VERTICAL_HOLE_T = 0;//附件工时-钻垂直通孔
            double WDRILL_HY_HOLE = 0;//单位工时-钻开合页孔
            double ADRILL_HY_HOLE = 0;//附件工时-钻开合页孔
            double WDRILL_PJ_HOLE = 0;//单位工时-钻开平铰孔
            double ADRILL_PJ_HOLE = 0;//附件工时-钻开平铰孔
            double WGROOVE_COLOR_SIDE = 0;//单位工时-槽侧边擦色
            double AGROOVE_COLOR_SIDE = 0;//附件工时-槽侧边擦色
            double WHOLE_COPPER_PLUG = 0;//单位工时-打铜头胶塞
            double AHOLE_COPPER_PLUG = 0;//附件工时-打铜头胶塞
            double WTWIST_TOOTHED_NUT = 0;//单位工时-拧带齿螺母
            double ATWIST_TOOTHED_NUT = 0;//附件工时-拧带齿螺母
            double WPASTE_LAMEX_LOGO = 0;//单位工时-贴美时LOGO
            double APASTE_LAMEX_LOGO = 0;//附件工时-贴美时LOGO
            double WPASTE_COMMON_LABLE = 0;//单位工时-贴通用标签
            double APASTE_COMMON_LABLE = 0;//附件工时-贴通用标签
            double WASSEMBLE_BRUSH_BAR = 0;//单位工时-装压毛刷条
            double AASSEMBLE_BRUSH_BAR = 0;//附件工时-装压毛刷条
            double WD24_Plate_Thickness_Cut_Slope = 0;//板厚切斜边-单位工时
            double AD24_Plate_Thickness_Cut_Slope = 0;//板厚切斜边-附加工时

            //获取数据库每个工序动作的单位工时和附加工时
            foreach (var drHours in dr2)
            {
                switch (drHours["OPERATIONAL_NAME"].ToString())
                {
                    case "X系数阔度W1":
                        TUNIT_WORKHOURSW1 = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        TATTACH_WORKHOURSW1 = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "X系数阔度W2":
                        TUNIT_WORKHOURSW2 = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        TATTACH_WORKHOURSW2 = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "X系数深度D1":
                        TUNIT_WORKHOURSD1 = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        TATTACH_WORKHOURSD1 = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "X系数深度D2":
                        TUNIT_WORKHOURSD2 = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        TATTACH_WORKHOURSD2 = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "X系数转角Z":
                        TUNIT_WORKHOURSZ = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        TATTACH_WORKHOURSZ = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "板面锣缺口":
                        WBOARD_GONG_GAP = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        ABOARD_GONG_GAP = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "板面锣圆角":
                        WBOARD_GONG_SIRCULAR_HORN = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        ABOARD_GONG_SIRCULAR_HORN = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "板面切封角":
                        WBOARD_T_EDGE_HORN = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        ABOARD_T_EDGE_HORN = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "X封直线边条":
                        WEDGE_S_STRAKE = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AEDGE_S_STRAKE = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "锣平面盲槽":
                        WGONG_PLANE_GROOVE_M = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AGONG_PLANE_GROOVE_M = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "锣平面通槽":
                        WGONG_PLANE_GROOVE_T = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AGONG_PLANE_GROOVE_T = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "X钻垂直盲孔":
                        WDRILL_VERTICAL_HOLE_M = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        ADRILL_VERTICAL_HOLE_M = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "X钻垂直通孔":
                        WDRILL_VERTICAL_HOLE_T = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        ADRILL_VERTICAL_HOLE_T = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "X钻开合页孔":
                        WDRILL_HY_HOLE = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        ADRILL_HY_HOLE = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "X钻开平铰孔":
                        WDRILL_PJ_HOLE = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        ADRILL_PJ_HOLE = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "槽侧边擦色":
                        WGROOVE_COLOR_SIDE = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AGROOVE_COLOR_SIDE = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "打铜头胶塞":
                        WHOLE_COPPER_PLUG = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AHOLE_COPPER_PLUG = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "拧带齿螺母":
                        WTWIST_TOOTHED_NUT = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        ATWIST_TOOTHED_NUT = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "贴美时LOGO":
                        WPASTE_LAMEX_LOGO = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        APASTE_LAMEX_LOGO = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "贴通用标签":
                        WPASTE_COMMON_LABLE = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        APASTE_COMMON_LABLE = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "装压毛刷条":
                        WASSEMBLE_BRUSH_BAR = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AASSEMBLE_BRUSH_BAR = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "板厚切斜边":
                        WD24_Plate_Thickness_Cut_Slope = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD24_Plate_Thickness_Cut_Slope = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                }


            }
            foreach (var drData in dr1)
            {
                TFACTOR_W1 = double.Parse(string.IsNullOrEmpty(drData["D24_Coefficient_Width_W1"].ToString()) ? "0" : drData["D24_Coefficient_Width_W1"].ToString());//系数阔度W1
                TFACTOR_W2 = double.Parse(string.IsNullOrEmpty(drData["D24_Coefficient_Width_W2"].ToString()) ? "0" : drData["D24_Coefficient_Width_W2"].ToString());//系数阔度W2
                TFACTOR_D1 = double.Parse(string.IsNullOrEmpty(drData["D24_Coefficient_Depth_D1"].ToString()) ? "0" : drData["D24_Coefficient_Depth_D1"].ToString());//系数深度D1
                TFACTOR_D2 = double.Parse(string.IsNullOrEmpty(drData["D24_Coefficient_Depth_D2"].ToString()) ? "0" : drData["D24_Coefficient_Depth_D2"].ToString());//系数深度D2
                TFACTOR_Z1 = double.Parse(string.IsNullOrEmpty(drData["D24_Coefficient_Rotation_Angle_Z"].ToString()) ? "0" : drData["D24_Coefficient_Rotation_Angle_Z"].ToString());//系数转角Z
                Tw1 = double.Parse(string.IsNullOrEmpty(drData["Width_1"].ToString().Replace("*", "")) ? "0" : drData["Width_1"].ToString().Replace("*", ""));//W1
                Tw2 = double.Parse(string.IsNullOrEmpty(drData["Width_2"].ToString().Replace("*", "")) ? "0" : drData["Width_2"].ToString().Replace("*", ""));//w2
                Td1 = double.Parse(string.IsNullOrEmpty(drData["Depth_1"].ToString().Replace("*", "")) ? "0" : drData["Depth_1"].ToString().Replace("*", ""));//d1
                Td2 = double.Parse(string.IsNullOrEmpty(drData["Depth_2"].ToString().Replace("*", "")) ? "0" : drData["Depth_2"].ToString().Replace("*", ""));//d2

                TBOARD_GONG_GAP = double.Parse(string.IsNullOrEmpty(drData["D24_Plate_Surface_Gong_Notch"].ToString()) ? "0" : drData["D24_Plate_Surface_Gong_Notch"].ToString());//板面锣缺口
                TBOARD_GONG_SIRCULAR_HORN = double.Parse(string.IsNullOrEmpty(drData["D24_Plate_Surface_Gong_Roundness"].ToString()) ? "0" : drData["D24_Plate_Surface_Gong_Roundness"].ToString());//板面锣圆角
                TBOARD_T_EDGE_HORN = double.Parse(string.IsNullOrEmpty(drData["D24_Plate_Surface_Cutting_and_Sealing_Angle"].ToString()) ? "0" : drData["D24_Plate_Surface_Cutting_and_Sealing_Angle"].ToString());//板面切封角
                TEDGE_S_STRAKE = double.Parse(string.IsNullOrEmpty(drData["D24_Seal_Linear_Edge"].ToString()) ? "0" : drData["D24_Seal_Linear_Edge"].ToString());//封直线边条

                TGONG_PLANE_GROOVE_M = double.Parse(string.IsNullOrEmpty(drData["D24_Gong_Plane_Blind_Groove"].ToString()) ? "0" : drData["D24_Gong_Plane_Blind_Groove"].ToString());//锣平面盲槽
                TGONG_PLANE_GROOVE_T = double.Parse(string.IsNullOrEmpty(drData["D24_Gong_Plane_Groove"].ToString()) ? "0" : drData["D24_Gong_Plane_Groove"].ToString());//锣平面通槽
                TDRILL_VERTICAL_HOLE_M = double.Parse(string.IsNullOrEmpty(drData["D24_Drilling_Vertical_Blind_Hole"].ToString()) ? "0" : drData["D24_Drilling_Vertical_Blind_Hole"].ToString());//钻垂直盲孔
                TDRILL_VERTICAL_HOLE_T = double.Parse(string.IsNullOrEmpty(drData["D24_Drilling_Vertical_Through_Hole"].ToString()) ? "0" : drData["D24_Drilling_Vertical_Through_Hole"].ToString());//钻垂直通孔

                TDRILL_HY_HOLE = double.Parse(string.IsNullOrEmpty(drData["D24_Drilling_The_Closure_Hole"].ToString()) ? "0" : drData["D24_Drilling_The_Closure_Hole"].ToString());//钻开合页孔
                TDRILL_PJ_HOLE = double.Parse(string.IsNullOrEmpty(drData["D24_Drilling_Flat_Reamer"].ToString()) ? "0" : drData["D24_Drilling_Flat_Reamer"].ToString());//钻开平铰孔
                TGROOVE_COLOR_SIDE = double.Parse(string.IsNullOrEmpty(drData["D24_Groove_Side_Rubbing"].ToString()) ? "0" : drData["D24_Groove_Side_Rubbing"].ToString());//槽侧边擦色
                THOLE_COPPER_PLUG = double.Parse(string.IsNullOrEmpty(drData["D24_Copper_Head_Plug"].ToString()) ? "0" : drData["D24_Copper_Head_Plug"].ToString());//打铜头胶塞

                TTWIST_TOOTHED_NUT = double.Parse(string.IsNullOrEmpty(drData["D24_Twisted_Tooth_Nut"].ToString()) ? "0" : drData["D24_Twisted_Tooth_Nut"].ToString());//拧带齿螺母
                TPASTE_LAMEX_LOGO = double.Parse(string.IsNullOrEmpty(drData["D24_LOGO"].ToString()) ? "0" : drData["D24_LOGO"].ToString());//贴美时LOGO
                TPASTE_COMMON_LABLE = double.Parse(string.IsNullOrEmpty(drData["D24_General_Label"].ToString()) ? "0" : drData["D24_General_Label"].ToString());//贴通用标签
                TASSEMBLE_BRUSH_BAR = double.Parse(string.IsNullOrEmpty(drData["D24_Packing_Brush_Strip"].ToString()) ? "0" : drData["D24_Packing_Brush_Strip"].ToString());//装压毛刷条
                TD24_Plate_Thickness_Cut_Slope = double.Parse(string.IsNullOrEmpty(drData["D24_Plate_Thickness_Cut_Slope"].ToString()) ? "0" : drData["D24_Plate_Thickness_Cut_Slope"].ToString());//板厚切斜边

            }
            //系数阔度W1+系数阔度W2+系数深度D1+系数深度D2+系数转角Z
            if (TFACTOR_W1 != 0 || TFACTOR_W2 != 0 || TFACTOR_D1 != 0 || TFACTOR_D2 != 0 || TFACTOR_Z1 != 0)
            {
                TD24 = 8 + (0.19 * (TFACTOR_W1 * Tw1 + TFACTOR_W2 * Tw2 + TFACTOR_D1 * Td1 + TFACTOR_D2 * Td2 + TFACTOR_Z1 * (Tw1 + Tw2 - (Td1 + Td2))));
            
            }
            if (TFACTOR_W1 != 0)
            {
                count++;
            }
            if (TFACTOR_W2 != 0)
            {
                count++;
            }
            if (TFACTOR_D1 != 0)
            {
                count++;
            }
            if (TFACTOR_D2 != 0)
            {
                count++;
            }
            if (TFACTOR_Z1 != 0)
            {
                count++;
            }
            //板面锣缺口
            if (TBOARD_GONG_GAP != 0)
            {
                TD24 = TD24 + (WBOARD_GONG_GAP * TBOARD_GONG_GAP + ABOARD_GONG_GAP);
                count++;
            }
            //板面锣圆角
            if (TBOARD_GONG_SIRCULAR_HORN != 0)
            {
                TD24 = TD24 + ((WBOARD_GONG_SIRCULAR_HORN * TBOARD_GONG_SIRCULAR_HORN) + ABOARD_GONG_SIRCULAR_HORN);
                count++;
            }
            //板面切封角
            if (TBOARD_T_EDGE_HORN != 0)
            {
                TD24 = TD24 + ((WBOARD_T_EDGE_HORN * TBOARD_T_EDGE_HORN) + ABOARD_T_EDGE_HORN);
                count++;
            }
            //封直线边条
            if (TEDGE_S_STRAKE != 0)
            {
                TD24 = TD24 + ((WEDGE_S_STRAKE * TEDGE_S_STRAKE * NumMAX(Tw1, Tw2)) + AEDGE_S_STRAKE);
                count++;
            }
            //锣平面盲槽
            if (TGONG_PLANE_GROOVE_M != 0)
            {
                if (NumMAX(Tw1, Tw2) < 1500)
                {
                    TD24 = TD24 + 8 + (50 * TGONG_PLANE_GROOVE_M);
                }
                else
                {
                    TD24 = TD24 + 8 + (70 * TGONG_PLANE_GROOVE_M);
                }
                count++;
            }
            //锣平面通槽
            if (TGONG_PLANE_GROOVE_T != 0)
            {
                TD24 = TD24 + (WGONG_PLANE_GROOVE_T * TGONG_PLANE_GROOVE_T) + AGONG_PLANE_GROOVE_T;
                count++;
            }
            //钻垂直盲孔
            if (TDRILL_VERTICAL_HOLE_M != 0)
            {
                if (TDRILL_VERTICAL_HOLE_M <= 6)
                {
                    TD24 = TD24 + 6 + (4 * TDRILL_VERTICAL_HOLE_M);
                }
                else if (TDRILL_VERTICAL_HOLE_M <= 12)
                {
                    TD24 = TD24 + 12 + (4 * TDRILL_VERTICAL_HOLE_M);
                }
                else if (TDRILL_VERTICAL_HOLE_M <= 15)
                {
                    TD24 = TD24 + 18 + (4 * TDRILL_VERTICAL_HOLE_M);
                }
                else if (TDRILL_VERTICAL_HOLE_M <= 28)
                {
                    TD24 = TD24 + 24 + (4 * TDRILL_VERTICAL_HOLE_M);
                }
                else
                {
                    TD24 = TD24 + 30 + (4 * TDRILL_VERTICAL_HOLE_M);
                }
                count++;
            }
            //钻垂直通孔
            if (TDRILL_VERTICAL_HOLE_T != 0)
            {
                TD24 = TD24 + (TDRILL_VERTICAL_HOLE_T * WDRILL_VERTICAL_HOLE_T) + ADRILL_VERTICAL_HOLE_T;
                count++;
            }
            //钻开合页孔
            if (TDRILL_HY_HOLE != 0)
            {
                TD24 = TD24 + (TDRILL_HY_HOLE * WDRILL_HY_HOLE) + ADRILL_HY_HOLE;
                count++;
            }
            //钻开平铰孔
            if (TDRILL_PJ_HOLE != 0)
            {
                TD24 = TD24 + (TDRILL_PJ_HOLE * WDRILL_PJ_HOLE) + ADRILL_PJ_HOLE;
                count++;
            }
            //槽侧边擦色
            if (TGROOVE_COLOR_SIDE != 0)
            {
                TD24 = TD24 + (TGROOVE_COLOR_SIDE * WGROOVE_COLOR_SIDE) + AGROOVE_COLOR_SIDE;
                count++;
            }
            //打铜头胶塞
            if (THOLE_COPPER_PLUG != 0)
            {
                TD24 = TD24 + (THOLE_COPPER_PLUG * WHOLE_COPPER_PLUG) + AHOLE_COPPER_PLUG;
                count++;
            }
            //拧带齿螺母
            if (TTWIST_TOOTHED_NUT != 0)
            {
                TD24 = TD24 + (TTWIST_TOOTHED_NUT * WTWIST_TOOTHED_NUT) + ATWIST_TOOTHED_NUT;
                count++;
            }
            //贴美时LOGO
            if (TPASTE_LAMEX_LOGO != 0)
            {
                TD24 = TD24 + (TPASTE_LAMEX_LOGO * WPASTE_LAMEX_LOGO) + APASTE_LAMEX_LOGO;
                count++;
            }
            //贴通用标签
            if (TPASTE_COMMON_LABLE != 0)
            {
                TD24 = TD24 + (TPASTE_COMMON_LABLE * WPASTE_COMMON_LABLE) + APASTE_COMMON_LABLE;
                count++;
            }
            //装压毛刷条
            if (TASSEMBLE_BRUSH_BAR != 0)
            {
                TD24 = TD24 + (0.1 * TASSEMBLE_BRUSH_BAR * NumMAX(Tw1, Tw2));
                count++;
            }
            //板厚切斜边
            if (TD24_Plate_Thickness_Cut_Slope != 0)
            {
                TD24 = TD24 + (TD24_Plate_Thickness_Cut_Slope * WD24_Plate_Thickness_Cut_Slope) + AD24_Plate_Thickness_Cut_Slope;
                count++;
            }
            //清洗时间
            if (TD24 != 0)
            {
                TD24 = TD24 + (0.5 * 0.000058 * Tw1 * Tw2 * 2) + 10;
                TBHours = 15;
            }
            //Total
            TD24 = TD24 + TBHours + (10 * count);
            return TD24;
        }
        private static double NumMAX(double Tw1, double Tw2)
        {
            if (Tw1 > Tw2)
            {
                return Tw1;
            }
            return Tw2;
        }
    }
}
